; Music of P-47 Freedom Fighter (1989) (Firebird)
; Ripped by Megachur the 11/11/2006

	write "P-47FREF.BIN"

music_date_rip	equ &0bb6
music_adr	equ &3a12
first_theme	equ 0
last_theme	equ 0

	read "music_header_v1_0.asm"

;&3a18 play x6

;org #25cb
;xor a		; stop
;ld (#3a12),a

.l3a15 equ $ + 3
.l3a13 equ $ + 1
.l3a12
	db #00,#00,#00,#d7,#85
.l3a17
	db #00
;
.real_play_music
;
	ld de,l3a17
	ld a,(de)
	or a
	jr z,l3a6f
	ld l,a
	sla l
	ld h,#00
	xor a
	ld (de),a
	ld de,l3ca9
	add hl,de
	ld a,(hl)
	inc hl
	ld h,(hl)
	ld l,a
	ld ix,l3b58
	ld a,(hl)
	inc hl
	sla a
	ld (l3a64),a
	ld (l3a46),a
	inc a
	ld (l3a4b),a
	ld (l3a69),a
	ld a,(hl)
.l3a46 equ $ + 2
	ld (ix+#00),a
	inc hl
	ld a,(hl)
.l3a4b equ $ + 2
	ld (ix+#01),a
	ld (ix+#06),#ff
	inc hl
	ld a,(hl)
	ld c,a
	inc hl
	ld a,(l3b5f)
	and c
	or (hl)
	ld (l3b5f),a
	inc hl
	ld ix,l3c26
	ld a,(hl)
.l3a64 equ $ + 2
	ld (ix+#00),a
	inc hl
	ld a,(hl)
.l3a69 equ $ + 2
	ld (ix+#01),a
	ld a,#01
	ld (l3ace),a
.l3a6f
	ld hl,l3a12
	bit 7,(hl)
	jr nz,l3a8f
	ld e,(hl)
	set 7,(hl)
	sla e
	ld d,#00
	ld hl,l3cdf
	add hl,de
	ld e,(hl)
	inc hl
	ld d,(hl)
	ld (l3a15),de
	ld (l3af7),de
	jp l3a8f
.l3a8f
	call l3a9d
	ld hl,l3a13
	ld a,(hl)
	or a
	jr z,l3ae3
	dec a
	ld (hl),a
	ret
.l3a9c
	inc c
.l3a9d
	ld hl,l3a9c
	dec (hl)
	jr nz,l3ac2
	ld (hl),#0c
	ld bc,l3b60
	ld hl,l3c26
	call l3acf
	ld bc,l3b61
	ld hl,l3c28
	call l3acf
	ld bc,l3b62
	ld hl,l3c2a
	call l3acf
	jr l3acb
.l3ac2
	ld a,(l3ace)
	or a
	ret z
	xor a
	ld (l3ace),a
.l3acb
	jp l3b42
.l3ace
	db #00
.l3acf
	ld e,(hl)
	inc hl
	ld d,(hl)
	ld a,d
	or e
	ret z
	inc de
	ld a,(de)
	or a
	jr nz,l3add
	ld d,a
	ld e,a
	ld (de),a
.l3add
	ld (hl),d
	dec hl
	ld (hl),e
	ld a,(de)
	ld (bc),a
	ret
.l3ae3
	ld a,(l3a12)
	and #7f
	ret z
	ld hl,(l3a15)
	ld a,(hl)
	cp #ff
	jr nz,l3b33
	inc hl
	ld a,(hl)
	or a
	jr nz,l3afc
.l3af7 equ $ + 1
	ld hl,#85d7
	jp l3b3b
.l3afc
	and #03
	ld c,a
	inc hl
	ld a,c
	or a
	jr z,l3b3f
	ld de,l3b5a
	dec a
	jr z,l3b0d
	ld de,l3b5c
.l3b0d
	ld a,(hl)
	push hl
	push de
	sub #0c
	ld l,a
	ld h,#00
	add hl,hl
	ld de,l3b66
	add hl,de
	pop de
	ld a,(hl)
	ld (de),a
	inc hl
	inc de
	ld a,(hl)
	ld (de),a
	ld hl,l3c2c
	ld (l3c28),hl
	ld (l3c2a),hl
	ld a,#01
	ld (l3ace),a
	pop hl
	inc hl
	jr l3b3b
.l3b33
	inc hl
	and #7f
	add #0a
	ld (l3a13),a
.l3b3b
	ld (l3a15),hl
	ret
.l3b3f
	inc hl
	jr l3b3b
.l3b42
	push hl
	ld b,#00
	ld hl,l3b58
.l3b48
	ld c,(hl)
	inc hl
	ld a,b
	push bc
	call l3c8b
	pop bc
	inc b
	ld a,b
	cp #10
	jr nz,l3b48
	pop hl
	ret
.l3b5f equ $ + 7
.l3b5e equ $ + 6
.l3b5c equ $ + 4
.l3b5a equ $ + 2
.l3b58
	db #00,#00,#00,#00,#00,#00,#01,#38
.l3b60
	db #00
.l3b61
	db #00
.l3b62
	db #00,#00,#00,#00
.l3b66
	dw #0eee,#0e18,#0d4d,#0c8e
	dw #0bda,#0b2f,#0a8f,#09f7
	dw #0968,#08e1,#0861,#07e9
	dw #0777,#070c,#06a7,#0647
	dw #05ed,#0598,#0547,#04fc
	dw #04b4,#0470,#0431,#03f4
	dw #03bc,#0386,#0353,#0324
	dw #02f6,#02cc,#02a4,#027e
	dw #025a,#0238,#0218,#01fa
	dw #01de,#01c3,#01aa,#0192
	dw #017b,#0166,#0152,#013f
	dw #012d,#011c,#010c,#00fd
	dw #00ef,#00e1,#00d5,#00c9
	dw #00be,#00b3,#00a9,#009f
	dw #0096,#008e,#0086,#007f
	dw #0077,#0071,#006a,#0064
	dw #005f,#0059,#0054,#0050
	dw #004b,#0047,#0043,#003f
	dw #003c,#0038,#0035,#0032
	dw #002f,#002d,#002a,#0028
	dw #0026,#0024,#0022,#0020
	dw #001e,#001c,#001b,#0019
	dw #0018,#0016,#0015,#0014
	dw #0013,#0012,#0011,#0010
.l3c26
	db #00,#00
.l3c28
	db #00,#00
.l3c2a
	db #00,#00
.l3c2c
	db #0a,#0a,#09,#09,#08,#08,#07,#07
	db #06,#06,#05,#05,#04,#04,#03,#03
	db #02,#02,#01,#01,#00
.l3c41
	db #0f,#0e,#0d,#0c,#0b,#0a,#09,#08
	db #07,#06,#05,#04,#03,#02,#01,#00
	db #0a,#0a,#0b,#0b,#0c,#0c,#0d,#0d
	db #0e,#0e,#0f,#0f,#0e,#0d,#0c,#0b
	db #0a,#09,#08,#07,#06,#05,#04,#03
	db #02,#01,#00,#0f,#0f,#0e,#0e,#0d
	db #0d,#0c,#0c,#0b,#0b,#0a,#0a,#09
	db #09,#08,#08,#07,#07,#06,#06,#05
	db #05,#04,#04,#03,#03,#02,#02,#01
	db #01,#00
.l3c8b
	ld b,#f4
	out (c),a
	ld b,#f6
	in a,(c)
	or #c0
	out (c),a
	and #3f
	out (c),a
	ld b,#f4
	out (c),c
	ld b,#f6
	ld c,a
	or #80
	out (c),a
	out (c),c
	ret
.l3ca9
	db #00,#00,#b7,#3c,#be,#3c,#c5,#3c
	db #cc,#3c,#d3,#3c,#da,#3c,#00,#2c
	db #01,#f6,#01,#2c,#3c,#01,#90,#01
	db #ed,#02,#6c,#3c,#02,#0a,#00,#db
	db #04,#51,#3c,#02,#0a,#00,#db,#04
	db #41,#3c,#02,#0a,#00,#db,#04,#51
	db #3c,#02,#50,#00,#db,#20
.l3cdf
	dw l3c41
	dw l85d7,l85d7
;	org #85d7
.l85d7
	db #ff,#91,#28,#ff,#92,#4a,#97,#97
	db #ff,#92,#4b,#97,#97,#ff,#91,#34
	db #ff,#92,#4c,#97,#97,#ff,#92,#47
	db #97,#ff,#91,#34,#ff,#92,#4a,#97
	db #97,#ff,#91,#34,#ff,#92,#4a,#97
	db #ff,#91,#2f,#ff,#92,#4b,#97,#97
	db #ff,#91,#32,#ff,#92,#4c,#97,#97
	db #ff,#91,#33,#ff,#92,#47,#97,#97
	db #ff,#91,#28,#ff,#92,#4a,#97,#97
	db #ff,#92,#4b,#97,#97,#ff,#91,#34
	db #ff,#92,#4c,#97,#97,#ff,#92,#47
	db #97,#ff,#91,#34,#ff,#92,#4a,#97
	db #97,#ff,#91,#34,#ff,#92,#4a,#97
	db #ff,#91,#2f,#ff,#92,#4b,#97,#97
	db #ff,#91,#32,#ff,#92,#4c,#97,#97
	db #ff,#91,#33,#ff,#92,#47,#97,#ff
	db #91,#33,#97,#ff,#91,#28,#ff,#92
	db #4a,#97,#97,#ff,#92,#4b,#97,#97
	db #ff,#91,#34,#ff,#92,#4c,#97,#97
	db #ff,#92,#47,#97,#ff,#91,#34,#ff
	db #92,#4a,#97,#97,#ff,#91,#34,#ff
	db #92,#4a,#97,#ff,#91,#2f,#ff,#92
	db #4b,#97,#97,#ff,#91,#32,#ff,#92
	db #4c,#97,#97,#ff,#91,#33,#ff,#92
	db #47,#97,#ff,#92,#4a,#97,#ff,#91
	db #28,#97,#ff,#92,#4a,#97,#ff,#92
	db #4b,#97,#97,#ff,#91,#34,#ff,#92
	db #4c,#97,#97,#ff,#92,#47,#97,#ff
	db #91,#34,#ff,#92,#4a,#97,#97,#ff
	db #91,#34,#ff,#92,#4a,#97,#ff,#91
	db #2f,#ff,#92,#4b,#97,#97,#ff,#91
	db #32,#ff,#92,#4c,#97,#97,#ff,#91
	db #33,#ff,#92,#47,#97,#97,#ff,#91
	db #2d,#ff,#92,#4f,#97,#97,#ff,#92
	db #50,#97,#97,#ff,#91,#39,#ff,#92
	db #51,#97,#97,#ff,#92,#4c,#97,#ff
	db #91,#39,#ff,#92,#4f,#97,#97,#ff
	db #91,#39,#ff,#92,#4f,#97,#ff,#91
	db #34,#ff,#92,#50,#97,#97,#ff,#91
	db #37,#ff,#92,#51,#97,#97,#ff,#91
	db #38,#ff,#92,#4c,#97,#97,#ff,#91
	db #2d,#ff,#92,#4f,#97,#97,#ff,#92
	db #50,#97,#97,#ff,#91,#39,#ff,#92
	db #51,#97,#97,#ff,#92,#4c,#97,#ff
	db #91,#39,#ff,#92,#4f,#97,#97,#ff
	db #91,#39,#ff,#92,#4f,#97,#ff,#91
	db #34,#ff,#92,#50,#97,#97,#ff,#91
	db #37,#ff,#92,#51,#97,#97,#ff,#91
	db #38,#ff,#92,#4c,#97,#ff,#91,#38
	db #97,#ff,#91,#2d,#ff,#92,#4f,#97
	db #97,#ff,#92,#50,#97,#97,#ff,#91
	db #39,#ff,#92,#51,#97,#97,#ff,#92
	db #4c,#97,#ff,#91,#39,#ff,#92,#4f
	db #97,#97,#ff,#91,#39,#ff,#92,#4f
	db #97,#ff,#91,#34,#ff,#92,#50,#97
	db #97,#ff,#91,#37,#ff,#92,#51,#97
	db #97,#ff,#91,#38,#ff,#92,#4c,#97
	db #ff,#92,#4f,#97,#ff,#91,#2d,#97
	db #ff,#92,#4f,#97,#ff,#92,#50,#97
	db #97,#ff,#91,#39,#ff,#92,#51,#97
	db #97,#ff,#92,#4c,#97,#ff,#91,#39
	db #ff,#92,#4f,#97,#97,#ff,#91,#39
	db #ff,#92,#4f,#97,#ff,#91,#34,#ff
	db #92,#50,#97,#97,#ff,#91,#37,#ff
	db #92,#51,#97,#97,#ff,#91,#38,#ff
	db #92,#4c,#97,#97,#ff,#91,#28,#ff
	db #92,#4a,#97,#97,#ff,#92,#4b,#97
	db #97,#ff,#91,#34,#ff,#92,#4c,#97
	db #97,#ff,#92,#47,#97,#ff,#91,#34
	db #ff,#92,#4a,#97,#97,#ff,#91,#34
	db #ff,#92,#4a,#97,#ff,#91,#2f,#ff
	db #92,#4b,#97,#97,#ff,#91,#32,#ff
	db #92,#4c,#97,#97,#ff,#91,#33,#ff
	db #92,#47,#97,#97,#ff,#91,#28,#ff
	db #92,#4a,#97,#97,#ff,#92,#4b,#97
	db #97,#ff,#91,#34,#ff,#92,#4c,#97
	db #97,#ff,#92,#47,#97,#ff,#91,#34
	db #ff,#92,#4a,#97,#97,#ff,#91,#34
	db #ff,#92,#4a,#97,#ff,#91,#2f,#ff
	db #92,#4b,#97,#97,#ff,#91,#32,#ff
	db #92,#4c,#97,#97,#ff,#91,#33,#ff
	db #92,#47,#97,#ff,#91,#33,#97,#ff
	db #91,#28,#ff,#92,#4a,#97,#97,#ff
	db #92,#4b,#97,#97,#ff,#91,#34,#ff
	db #92,#4c,#97,#97,#ff,#92,#47,#97
	db #ff,#91,#34,#ff,#92,#4a,#97,#97
	db #ff,#91,#34,#ff,#92,#4a,#97,#ff
	db #91,#2f,#ff,#92,#4b,#97,#97,#ff
	db #91,#32,#ff,#92,#4c,#97,#97,#ff
	db #91,#33,#ff,#92,#47,#97,#ff,#92
	db #4a,#97,#ff,#91,#28,#97,#ff,#92
	db #4a,#97,#ff,#92,#4b,#97,#97,#ff
	db #91,#34,#ff,#92,#4c,#97,#97,#ff
	db #92,#47,#97,#ff,#91,#34,#ff,#92
	db #4a,#97,#97,#ff,#91,#34,#ff,#92
	db #4a,#97,#ff,#91,#2f,#ff,#92,#4b
	db #97,#97,#ff,#91,#32,#ff,#92,#4c
	db #97,#97,#ff,#91,#33,#ff,#92,#47
	db #97,#97,#ff,#91,#2f,#ff,#92,#53
	db #97,#ff,#92,#51,#97,#ff,#91,#3b
	db #ff,#92,#53,#97,#ff,#91,#2f,#ff
	db #92,#51,#97,#ff,#91,#39,#ff,#92
	db #53,#97,#ff,#92,#51,#97,#ff,#91
	db #3b,#ff,#92,#53,#97,#ff,#91,#2f
	db #ff,#92,#51,#97,#ff,#92,#53,#97
	db #ff,#91,#2f,#97,#ff,#91,#3b,#97
	db #ff,#91,#2f,#97,#ff,#91,#39,#97
	db #ff,#92,#4e,#97,#ff,#91,#3b,#ff
	db #92,#51,#97,#ff,#92,#52,#97,#ff
	db #91,#2d,#ff,#92,#51,#97,#ff,#92
	db #4f,#97,#ff,#91,#39,#ff,#92,#51
	db #97,#ff,#91,#2d,#ff,#92,#4f,#97
	db #ff,#91,#37,#ff,#92,#51,#97,#ff
	db #92,#4f,#97,#ff,#91,#39,#ff,#92
	db #51,#97,#ff,#91,#2d,#ff,#92,#4f
	db #97,#ff,#92,#51,#97,#ff,#91,#2d
	db #97,#ff,#91,#39,#97,#ff,#91,#2d
	db #97,#ff,#91,#37,#97,#ff,#92,#4e
	db #97,#ff,#91,#38,#ff,#92,#51,#97
	db #ff,#91,#39,#ff,#92,#52,#97,#ff
	db #91,#2f,#ff,#92,#53,#97,#ff,#92
	db #51,#97,#ff,#91,#3b,#ff,#92,#53
	db #97,#ff,#92,#51,#97,#ff,#91,#39
	db #ff,#92,#53,#97,#ff,#92,#51,#97
	db #ff,#91,#3b,#ff,#92,#53,#97,#ff
	db #91,#2f,#ff,#92,#51,#97,#ff,#92
	db #53,#97,#ff,#91,#2f,#ff,#92,#58
	db #97,#ff,#91,#3b,#97,#ff,#91,#2f
	db #97,#ff,#91,#39,#97,#ff,#92,#4e
	db #97,#ff,#91,#3b,#ff,#92,#50,#97
	db #ff,#92,#52,#97,#ff,#91,#2d,#ff
	db #92,#51,#97,#ff,#92,#4f,#97,#ff
	db #91,#39,#ff,#92,#51,#97,#ff,#91
	db #2d,#ff,#92,#4f,#97,#ff,#91,#37
	db #ff,#92,#51,#97,#ff,#92,#4f,#97
	db #ff,#91,#39,#ff,#92,#51,#97,#ff
	db #91,#2d,#ff,#92,#4f,#97,#ff,#92
	db #51,#97,#ff,#91,#2d,#97,#ff,#91
	db #39,#97,#97,#ff,#91,#3a,#97,#97
	db #ff,#91,#3a,#97,#97,#ff,#91,#2f
	db #ff,#92,#53,#97,#ff,#92,#51,#97
	db #ff,#91,#3b,#ff,#92,#53,#97,#ff
	db #91,#2f,#ff,#92,#51,#97,#ff,#91
	db #39,#ff,#92,#53,#97,#ff,#92,#51
	db #97,#ff,#91,#3b,#ff,#92,#53,#97
	db #ff,#91,#2f,#ff,#92,#51,#97,#ff
	db #92,#53,#97,#ff,#91,#2f,#97,#ff
	db #91,#3b,#97,#ff,#91,#2f,#97,#ff
	db #91,#39,#97,#ff,#92,#4e,#97,#ff
	db #91,#3b,#ff,#92,#51,#97,#ff,#92
	db #52,#97,#ff,#91,#2d,#ff,#92,#51
	db #97,#ff,#92,#4f,#97,#ff,#91,#39
	db #ff,#92,#51,#97,#ff,#91,#2d,#ff
	db #92,#4f,#97,#ff,#91,#37,#ff,#92
	db #51,#97,#ff,#92,#4f,#97,#ff,#91
	db #39,#ff,#92,#51,#97,#ff,#91,#2d
	db #ff,#92,#4f,#97,#ff,#92,#51,#97
	db #ff,#91,#2d,#97,#ff,#91,#39,#97
	db #ff,#91,#2d,#97,#ff,#91,#37,#97
	db #ff,#92,#4e,#97,#ff,#91,#38,#ff
	db #92,#51,#97,#ff,#91,#39,#ff,#92
	db #52,#97,#ff,#91,#2f,#ff,#92,#53
	db #97,#ff,#92,#51,#97,#ff,#91,#3b
	db #ff,#92,#53,#97,#ff,#92,#51,#97
	db #ff,#91,#39,#ff,#92,#53,#97,#ff
	db #92,#51,#97,#ff,#91,#3b,#ff,#92
	db #53,#97,#ff,#91,#2f,#ff,#92,#51
	db #97,#ff,#92,#53,#97,#ff,#91,#2f
	db #ff,#92,#58,#97,#ff,#91,#3b,#97
	db #ff,#91,#2f,#97,#ff,#91,#39,#97
	db #ff,#92,#4e,#97,#ff,#91,#3b,#ff
	db #92,#50,#97,#ff,#92,#52,#97,#ff
	db #91,#2d,#ff,#92,#51,#97,#ff,#92
	db #4f,#97,#ff,#91,#39,#ff,#92,#51
	db #97,#ff,#91,#2d,#ff,#92,#4f,#97
	db #ff,#91,#37,#ff,#92,#51,#97,#ff
	db #92,#4f,#97,#ff,#91,#39,#ff,#92
	db #51,#97,#ff,#91,#2d,#ff,#92,#4f
	db #97,#ff,#92,#51,#97,#ff,#91,#2d
	db #97,#ff,#91,#39,#97,#97,#ff,#91
	db #3a,#97,#97,#ff,#91,#3a,#97,#97
	db #ff,#00,#58,#00,#48,#28,#00,#00
	db #00,#28,#3a

;
.init_music
;org #25bb
;
	ld a,#01		; init
	ld (l3a12),a
	ld (l3b5e),a
	ld a,#38
	ld (l3b5f),a
	ret
;
.play_music			; added by Megachur
;
	call real_play_music
	call real_play_music
	call real_play_music
	call real_play_music
	call real_play_music
	jp real_play_music	; added by Megachur
;
.game_name
	db "P-47 Freedom Fighter",0
.game_year
	db "1989",0
.game_publisher
	db "Firebird",0
.music_author
	db "",0
.music_comment
	db "",0

	read "music_end_v1_0.asm"

